﻿using DotLiquid;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;

namespace FastCodeGeneration.Entity
{
    [LiquidType("*")]
    [SugarTable("table_column")]//当和数据库名称不一样可以设置表别名 指定表明
    public class TableColumn
    {
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]//数据库是自增才配自增 
        public int? Id { set; get; }

        /// <summary>
        /// 项目id
        /// </summary>
        [SugarColumn(ColumnName = "ProjectId")]
        public int? ProjectId { get; set; }

        /// <summary>
        /// 列名称
        /// </summary>
        public string Name { set; get; } = string.Empty;

        /// <summary>
        /// 表名称
        /// </summary>
        public string TableName { set; get; } = string.Empty;
        /// <summary>
        /// 列备注
        /// </summary>
        public string Description { get; set; } = string.Empty;

        /// <summary>
        /// 列类型
        /// </summary>
        public string ColumnType { set; get; } = string.Empty;

        /// <summary>
        /// 字段类型
        /// </summary>
        public string FieldType { set; get; } = string.Empty;

        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { set; get; } = string.Empty;

        /// <summary>
        /// 长度
        /// </summary>
        public int Length { set; get; }


        public int DecimalDigits { set; get; }

        public int Scale { set; get; }

        /// <summary>
        /// 是否主键（1是）
        /// </summary>
        public bool IsPrimaryKey { set; get; }

        /// <summary>
        /// 是否自增（1是）
        /// </summary>
        public bool IsIdentity { set; get; }

        /// <summary>
        /// 是否必填（1是）
        /// </summary>
        public bool IsRequired { set; get; }

        /// <summary>
        /// 是否为插入字段（1是）
        /// </summary>
        public bool IsInsert { set; get; } = true;

        /// <summary>
        /// 是否编辑字段（1是）
        /// </summary>
        public bool IsEdit { set; get; } = true;

        /// <summary>
        /// 是否列表字段（1是）
        /// </summary>
        public bool IsList { set; get; } = true;

        /// <summary>
        /// 是否查询字段（1是）
        /// </summary>
        public bool IsQuery { set; get; } = true;

        /// <summary>
        /// 查询方式（等于、不等于、大于、小于、范围）
        /// </summary>
        public string QueryType { set; get; } = string.Empty;

        /// <summary>
        /// 显示类型（文本框、文本域、下拉框、复选框、单选框、日期控件）
        /// </summary>
        public string HtmlType { set; get; } = string.Empty;

        /// <summary>
        /// 字典类型
        /// </summary>
        public string DictType { set; get; } = string.Empty;

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { set; get; }

    }
}
